/*
 * MonthChargingEventResource.h
 *
 *  Created on: 2014. 3. 5.
 *      Author: mega
 */

#ifndef MONTHCHARGINGEVENTRESOURCE_H_
#define MONTHCHARGINGEVENTRESOURCE_H_

#include <map>

namespace ProjectZ { namespace NResource {

class MonthChargingEventResource
{
public:
	class MonthChargingEvent
	{
	public:
		struct Flyweight
		{
			int _SEQ;
			int _ITEM_SHEET;
			int _ITEM_TID;
			int _ITEM_QUANTITY;
			Toolkit::Str<1024> _URL;
			time_t _START_DATE;
			time_t _END_DATE;
		};

	public:
		MonthChargingEvent();
		virtual ~MonthChargingEvent();

		bool		LoadResource(int company, int salecode);
		Flyweight *	GetFly();

	private:
		void		Clear();

	public:
		typedef std::map<int, Flyweight *> MONTHCHARGINGTREE;

	private:
		MONTHCHARGINGTREE clsFlyTree;
	};

public:
	MonthChargingEventResource();
	virtual ~MonthChargingEventResource();

	bool		LoadResource();
	MonthChargingEvent::Flyweight * GetFly(User * pUser);

	bool		IsRecvMonthChargeEventItem(User * pUser);
	void		SendMonthChargeEventItem(User * pUser);

private:
	MonthChargingEvent * pMonthChargingAD;
	MonthChargingEvent * pMonthChargingIOS;
};

} /*NResource*/ } /*ProjectZ*/


#endif /* MONTHCHARGINGEVENTRESOURCE_H_ */
